﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/common.css">
<link rel="stylesheet" type="text/css" href="css/account_1109.css">

<title>个人资料-修改密码</title>
<script src="http://s1.vipshop.com/jquery/lib/jquery.js?v=1.91"></script><script src="http://s1.vipshop.com/js/md5.js?v=1.91"></script>
<script>
var go_suc_url = 'amend.php';
var new_psw = 0;

function unload_info()
{
	if (unload_alert)
	{
		return confirm('密码尚未修改，您确认退出？');
		
	}
}

function up_pwd()
{
    if($("#new_pwd").val().length <6) {
        alert('新密码不能小于6位');
        return false;
    }
    if($("#new_pwd").val() != $("#new_pwd2").val()) {
        alert('两次输入的新密码不一致，请检查');
        return false;
    }
	if (new_psw != 1)
	{
		$("#old_pwd").val(hex_md5($("#old_pwd").val()));
	}    
    $("#new_pwd").val(hex_md5($("#new_pwd").val()));
    $("#new_pwd2").val(hex_md5($("#new_pwd2").val()));
  
  $.ajax({
         type: "post",
		  url: "up_pwd.php",
		 data: "old_pwd="+$("#old_pwd").val()+"&new_pwd="+$("#new_pwd").val()+"&new_pwd2="+$("#new_pwd2").val(), 
		 success: function(responseText,statusText){
		   //alert(responseText);
		   document.up_form1.reset();
		   switch(parseInt(responseText))
		   {
		     case 1:
			    alert("旧密码输入不正确，请再次输入!");
				break;
			  case 2:
			     alert("密码修改成功!");
				 parent.flag_change();
				 if (go_suc_url == 'amend.php')
				 	location.href=go_suc_url;
				else
					parent.location.href=go_suc_url;
				 break;
			  case 3:
			   if (document.getElementById('old_pwd').type == 'password')
			     alert("请填写旧密码!");
			   else
			   	 alert("请填写您的生日!");
				 //parent.showlayer();
				 //parent.document.getElementById("inner_div").innerHTML="<div style=\"text-align:center;\">请填写旧密码！</div>";
				 break;
				
			  case 4:
			     alert("新密码只能是6-12位之间!");	
				 break; 
			  case 5:
			     alert("两次密码输入不一致!");
				 break;
			  case 6:
			  	alert('生日格式不正确!');
		   }
		 }
  });
}
function chkpwd(obj,chkobj){
    var t=obj.value;
    var id=getResult(t);
    var bImg="../img/account/msg$.gif";
    var Bobj=document.getElementById(chkobj);
    Bobj.style.background="url(" + bImg.replace('$',id) + ") no-repeat left " ;
    Bobj.className='chkResult2';
}

function getResult(s){
    var ls = 0;
    if(s.length < 7){
       return 0;
    }
    if (s.match(/[a-z]/ig)){
       ls++;
    }
    if (s.match(/[0-9]/ig)){
       ls++;
    }
    if (s.match(/(.[^a-z0-9])/ig)){
       ls++;
    }
    if(s.length >7){
        ls++;
    }
    return ls
}

</script>

</head>

<body >
<div class="account_base_div">
<img src="img/xgmm.gif" border="0" />
<div class="border_div">
  <form name="up_form1" id="up_form1" method="post" action="up_pwd.php">
  <div class="zfmm">
    <p><b>修改您的密码，请输入以下信息：</b>（带*为必填项。）</p>
	<p>	<label>旧 &nbsp;密  &nbsp;码：</label><input name="old_pwd" id="old_pwd" type="password"/>
	    </p>
    <p><label>新 &nbsp;密  &nbsp;码：</label><input name="new_pwd" id="new_pwd" type="password"/>
	  （至少6位）
	</p>
	<p><label>确认新密码：</label><input name="new_pwd2" id="new_pwd2" type="password"/></p>
	<p class="btn"><a href="#" onclick="up_pwd()" class="fl" style="margin-right:10px;"><img border="0" src="img/tj.gif" /></a><a href="#" class="fl"><img border="0" src="img/qbchongz.gif" /></a></p>
  </div>
  </form>

</div>   
<div class="border_div">
  <form id="upqa" name="upqa" action="?act=upqa" onsubmit="return confirm('确定提交吗');" method="post" >
  <div class="zfmm">
     <p><b>您的账户已经设置了密码保护，如需修改，请先回答如下问题：</b></p>
   <p>问&nbsp;&nbsp;&nbsp;&nbsp;题： 我叫什么</p>
      
	<p><label>答&nbsp;&nbsp;&nbsp;&nbsp;案：</label><input type="text" name="a" value="" maxlength="32"/>
	</p>
	<p class="btn"><input type="image" border="0" src="img/tj.gif" class="fl" style="border:none;margin-right:10px;"/><a href="#" class="fl"><img border="0" onclick="document.upqa.reset();" src="img/qbchongz.gif" /></a> </p>
  </div>
  </form>
</div>
   

</div>

</body>
</html>














